package cn.nawang.ebeim.client.bean;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class RecoveryQueue {
  private static BlockingQueue<RecoveryTask> recoveryQueue =
      new ArrayBlockingQueue<RecoveryTask>(ClientConfiguration.getQueueSize());

  public static BlockingQueue<RecoveryTask> getRecoveryQueue() {
    return recoveryQueue;
  }

  public static void enqueue(RecoveryTask task) throws InterruptedException {
    recoveryQueue.put(task);
  }

  public static RecoveryTask dequeue() throws InterruptedException {
    return recoveryQueue.take();
  }

  public static boolean isEmpty() {
    return recoveryQueue.isEmpty();
  }
}
